//导入instance实例
import instance from "@/utils/request";

//获取所有角色列表
export function getRoleList(params) {
    return instance({
        url: '/sys/role',
        params
    })
}

//根据ID编辑角色
export function editRoleList(data) {
    return instance({
        url: `/sys/role/${data.id}`,
        method: 'PUT',
        data
    })
}

//根据ID删除角色
export function delRoleList(id) {
    return instance({
        url: `/sys/role/${id}`,
        method:'DELETE'
    })
}

//添加角色
export function addRoleList(data) {
    return instance({
        url: '/sys/role',
        method: 'POST',
        data
    })
}

//根据ID获取角色详情
export function getRoleDetailApi(id) {
    return instance({
        url:`/sys/role/${id}`
    })
}


//给角色分配权限
export function assignRoleApi(data) {
    return instance({
        url: '/sys/role/assignPrem',
        method: 'PUT',
        data
    })
}